from fastapi import FastAPI
from starlette.middleware.base import BaseHTTPMiddleware
from hooks.middlewares import db_session_middleware
from routers.seckill import router as seckill_router
from routers.order import router as order_router
app = FastAPI()

app.add_middleware(BaseHTTPMiddleware, dispatch=db_session_middleware)
app.include_router(order_router, prefix="/order", tags=["order"])
app.include_router(seckill_router, prefix='/seckill',tags=["seckill"])

@app.get("/")
async def root():
    return {"message": "Hello World"}


@app.get("/hello/{name}")
async def say_hello(name: str):
    return {"message": f"Hello {name}"}
